package com.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;

import com.common.redis.RedisClient;
import com.common.redis.RedisClientImpl;
import com.common.redis.StringValueOperations;

@Configuration
@EnableCaching
public class RedisConfiguration {

    @Bean
    @Autowired
    public ValueOperations<String, String> valueOps(StringRedisTemplate stringRedisTemplate) {
        return new StringValueOperations(stringRedisTemplate);
    }

    @Bean
    @Autowired
    public RedisClient redisClient(ValueOperations<String, String> valueOps) {
        return new RedisClientImpl(valueOps);
    }
}
